#import "OmReportUserVC.h"
@interface OmReportUserVC ()
@property (nonatomic, strong) UITextView *reportDetailTextView;
@property (nonatomic, strong) UIButton *sendButton;
@end
@implementation OmReportUserVC
- (void)configSelf {
    [self setHiddenForTabBar:YES navigationBar:NO];
    self.title = [NSString stringWithFormat:@"举报%@", self.enemyUID];
}
- (void)allocateComponents {
    self.reportDetailTextView = [[UITextView alloc] init];
    ViewBorderRadius(self.reportDetailTextView, 10, 1, CLineColor);
    self.reportDetailTextView.zw_placeHolder = @"请输入举报详情...";
    [self.view addSubview:self.reportDetailTextView];
    self.sendButton = [[UIButton alloc] init];
    ViewBorderRadius(self.sendButton, 10, 1, CLineColor);
    [self.sendButton addTarget:self action:@selector(onSendButtonTap) forControlEvents:UIControlEventTouchUpInside];
    [self.sendButton setBackgroundColor:UIColorWhite];
    [self.sendButton setTitle:@"提交举报" forState:UIControlStateNormal];
    [self.sendButton setTitleColor:UIColorBlack forState:UIControlStateNormal];
    [self.view addSubview:self.sendButton];
}
- (void)layoutComponents {
    [self.reportDetailTextView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view.mas_top).offset(20);
        make.width.equalTo(@(KScreenWidth - 40));
        make.height.equalTo(@(KScreenHeight * 0.4));
        make.centerX.equalTo(self.view);
    }];
    [self.sendButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.reportDetailTextView.mas_bottom).offset(20);
        make.width.equalTo(self.reportDetailTextView);
        make.height.equalTo(@(50));
        make.centerX.equalTo(self.view);
    }];
}
- (void)onSendButtonTap {
    NSString *url = [[CYURLUtils sharedCYURLUtils] makeURLWithC:@"user_api" A:@"do_report_user"];
    NSMutableDictionary *param = [NSMutableDictionary dictionary];
    param[@"uid"] = self.selfUID;
    param[@"to_user_id"] = self.enemyUID;
    param[@"token"] = curUser.token;
    param[@"type"] = @(4);
    param[@"content"] = self.reportDetailTextView.text;
    [CYNET POSTv2:url parameters:param responseCache:^(id responseObject) {
    } success:^(id responseObject) {
        [[HUDHelper sharedInstance] tipMessage:ASLocalizedString(@"举报成功")];
        [self.navigationController popViewControllerAnimated:YES];
    } failure:^(NSString *error) {
    } hasCache:NO];
}
@end
